package cn.bdqn.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.bdqn.dao.InvitationMapper;
import cn.bdqn.dao.ReplyMapper;
import cn.bdqn.entity.Reply;
import cn.bdqn.service.ReplyService;
import cn.bdqn.util.Page;

@Service
public class ReplyServiceImpl implements ReplyService {

	@Resource
	private ReplyMapper replyMapper;
	@Resource
	private InvitationMapper invitationMapper;

	@Override
	public List<Reply> getReplyPageListById(Integer id,Page page) {
		return replyMapper.getReplyPageListById(id,(page.getPageIndex()-1)*page.getPageSize(),page.getPageSize());
	}

	@Override
	public List<Reply> getReplyListById(Integer id) {
		return replyMapper.getReplyListById(id);
	}

	@Override
	public Integer addReplyById(Reply reply) {
		return replyMapper.addReplyById(reply);
	}

	@Override
	public Integer delReply(Integer id) {
		if(replyMapper.delReply(id) == 1 && invitationMapper.delInvitation(id) == 1){
			return 1;
		}
		return -1;
	}
	

}
